#include <stdio.h>

void data_type() {
  // 打印 40 个*号
  for (int i = 0; i < 40; i++) {
    printf("*");
  }
  printf("Data Type\n");
  // ! char有 255 个字符
  char c0 = 'b';
  unsigned char c1 = 255;
  signed char c2 = 127;
  printf("size of char: %zd\n", sizeof(char)); // 1 byte on all systems
  printf("size of unsigned char: %zd\n", sizeof(unsigned char));
  printf("size of signed char: %zd\n", sizeof(signed char));
  // printf("c0: %zd\n", c0); // 98

  // ! unsigned/signed
  // ! long/short
  int a0 = 10;
  short a1 = 13;
  long a2 = 16;
  unsigned a3 = 20;
  signed a4 = 11;
  unsigned short a5 = 13;
  signed short a6 = 13;
  unsigned long a7 = 16;
  signed long a8 = 16;
  printf("size of int: %zd\n",
         sizeof(int)); // 4 bytes on 32-bit system, 8 bytes on 64-bit system
  printf("size of short: %zd\n", sizeof(short));
  printf("size of long: %zd\n", sizeof(long));
  printf("size of unsigned: %zd\n", sizeof(unsigned));
  printf("size of signed: %zd\n", sizeof(signed));
  printf("size of unsigned short: %zd\n", sizeof(unsigned short));
  printf("size of signed short: %zd\n", sizeof(signed short));
  printf("size of unsigned long: %zd\n", sizeof(unsigned long));
  printf("size of signed long: %zd\n", sizeof(signed long));

  // ! %zd is the size_t type, which is the unsigned integer type that is used
  // to represent the size of an object in bytes.
  float f0 = 1.0f;
  double f1 = 2.123f;
  long double f2 = 3.14f;
  printf("size of float: %zd\n",
         sizeof(float)); // 4 bytes on 32-bit system, 8 bytes on 64-bit system
  printf("size of double: %zd\n", sizeof(double));
  printf("size of long double: %zd\n", sizeof(long double));

  _Bool b0 = 1;
  _Bool b1 = 0;
  printf("size of _Bool: %zd\n", sizeof(_Bool)); // 1 byte on all systems
}
